<template>
  <div>
    <van-nav-bar
        title='账号注销'
        placeholder
        fixed
        left-arrow
        @click-left="goBack"
    />
    <div>

      <van-divider>注意:请确保所有交易已完结且无纠纷，账号必须在7日之内没有任何交易，并且账号注销以后，账号的信息以及商品的上架信息会全部清空，账号注销后因历史交易可能产生的退换货、维权相关的资金退回等权益将视作自动放弃</van-divider>
    </div>
    <div style="margin-left: 70px;font-size: 14px;margin-top: 320px">
      <van-checkbox v-model="checked"
      >已阅读并同意账号注销重要提醒</van-checkbox>
    </div>
    <div  >
      <van-button round type="info" block style="position: fixed;left: 0px" @click="submit">确定</van-button>
    </div>
  </div>
</template>

<script>
import {Toast} from "vant";
import axios from "axios";

export default {
  name: "AccountCancellation",
  data(){
    return{
      user_id:'',
      checked:false,
    }
  },
  methods:{
    goBack() {
      this.$router.push("account-safety?user_id="+this.user_id);
    },
    submit(){
      var _this = this
      if(_this.checked==false){
        Toast("请先阅读并勾选注意!")
      }
      else if(_this.checked==true){
        _this.axios({
          method:'get',
          url:'/user_edit/account_cancellation/'+_this.user_id,
        }).then(function (rep){
          if(rep.data.message=="成功"){
            alert("账号已成功注销")
            _this.$router.push("index");
          }
        })
      }
    }
  },
  created() {
    var _this = this
    _this.user_id = _this.$route.query.user_id
  },
}
</script>

<style scoped>

</style>